package com.aivin.lib_login;

import android.content.Context;
import android.widget.Toast;

import com.aivin.lib_base.tool.RouteUtils;
import com.aivin.lib_base.tool.WkLog;
import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.facade.service.PretreatmentService;

@Route(path = RouteUtils.MyPretreatmentService)
public class MyPretreatmentService implements PretreatmentService {
    @Override
    public boolean onPretreatment(Context context, Postcard postcard) {
        String path = postcard.getPath() ;
        if(path.equals(RouteUtils.EnglishListActivity)){
            boolean isLogined = true ;
            if (!isLogined){
                Toast.makeText(mcontext   , "请先登录", Toast.LENGTH_SHORT).show() ;
                return  false ;
            }
        }
        return true;
    }

    private Context mcontext ;
    @Override
    public void init(Context context) {
        this.mcontext = context ;
    }
}
